package server;

/**
 * Die Klasse Produkt stellt alles dar, was gekauft werden kann.
 * Jedes Produkt besitzt einen Verkaufspreis.  
 * @author reto
 *
 */
public class Product {
	private String name;
	private String description;
	private double price;


	/**
	 * 
	 * @param name Name des Produktes
	 * @param description Beschreibung des Produktes
	 * @param price Verkaufspreis des Produktes
	 */
	public Product(final String name, final String description, final double price) {
		super();
		this.name = name;
		this.description = description;
		this.price = price;
		
	}
	
	/**
	 * 
	 * @return Beschreibung des Produktes
	 */
	public String getDescription() {
		return this.description;
	}
	
	/**
	 * 
	 * @return Name des Produktes
	 */
	public String getName() {
		return this.name;
	}
	
	/**
	 * 
	 * @return Verkaufspreis des Produktes
	 */
	public double getPrice() {
		return this.price;
	}
	
		
	
	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((this.name == null) ? 0 : this.name.hashCode());
		return result;
	}
	@Override
	public boolean equals(final Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (this.getClass() != obj.getClass()) {
			return false;
		}
		final Product other = (Product) obj;
		if (this.name == null) {
			if (other.name != null) {
				return false;
			}
		} else if (!this.name.equals(other.name)) {
			return false;
		}
		return true;
	}
	@Override
	public String toString() {
		return this.getName();
	}
}
